package com.example.video.adapter

import android.graphics.Color
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.base.entity.CategoryEntityItem
import com.example.video.R

class OneAdapter :BaseQuickAdapter<CategoryEntityItem,BaseViewHolder>(R.layout.item_one) {
    //设置选中的文字颜色
    var selectType = 515
    override fun convert(holder: BaseViewHolder, item: CategoryEntityItem) {
        holder.setText(R.id.one_tv,item.name)
        if(item.id==selectType){
            holder.getView<TextView>(R.id.one_tv).setTextColor(Color.RED)
        }else{
            holder.getView<TextView>(R.id.one_tv).setTextColor(Color.BLACK)
        }
    }
    //修改选中的
    fun setType(type:Int){
        selectType = type
        notifyDataSetChanged()
    }
}